/*******************************************************************************
 * @brief: 请填写简介
 * @Author:   aple
 * @Date: 2022-10-27 20:40:12
 * @LastEditors: aple
 * @LastEditTime: 2022-10-28 20:52:42
 * @Verision: 1.0.0.0
 ******************************************************************************/
#include "bsp.h"

// THUMB指令不支持汇编内联
//采用如下方法实现执行汇编指令WFI
void wfi_set(void)
{
	__WFI();
}

/*******************************************************************************
 * @brief: 
 * @param iIRQn
 * @param priority
 * @param newst
 * @return {*}
 ******************************************************************************/
void nvic_irq_set(uint32_t iIRQn, uint32_t priority, uint8_t newst)
{
	intx_alloc();

	IRQn_Type IRQn = (IRQn_Type)iIRQn;

	intx_disable();

	if (newst)
	{
		NVIC_SetPriority(IRQn, priority << 5);
		NVIC_EnableIRQ(IRQn);
	}
	else
	{
		NVIC_DisableIRQ(IRQn);
	}

	intx_enable();
}
